//
//  YXFileManager.h
//  MockProject
//
//  Created by FanYu on 29/8/2016.
//  Copyright © 2016 niuzhaowang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YXTaskModel.h"
#import "YXTool.h"
#import "DownloadTask.h"
#import "AppDelegate.h"

@interface YXTaskManager : NSObject

+ (void)loadTaskToDB;
+ (void)saveTask:(YXTaskModel *)model;

+ (NSArray *)getTasksWithStatus:(TaskStatus)status byTimeline:(BOOL)newOnTop;
+ (NSArray *)getTasksByTitleAscendingWithStatus:(TaskStatus)status;
+ (DownloadTask *)getTaskAtIndex:(NSInteger)index;
+ (DownloadTask *)getTaskWithUID:(NSInteger)uid;
+ (TaskStatus)getTaskStatusWithUID:(NSInteger)uid;
+ (NSArray *)getTasksForInProcess:(BOOL)newOnTop;
+ (NSString *)getTasksSizePercentWithUID:(NSString *)uid;
+ (NSString *)getTaskProgressPercentWithUID:(NSString *)uid;
+ (NSArray *)getTasksForInProcessWithoutDownloading:(BOOL)newOnTop;
+ (NSString *)getTaskFilePathWithUID:(NSString *)uid;
+ (NSArray *)getTasksForInProcessWithoutFailed:(BOOL)newOnTop;


+ (void)updateTaskStatus:(TaskStatus)status withUID:(NSInteger)uid;
+ (void)updateTaskSizeWithUID:(NSString *)uid;
+ (void)updateTaskDownloadSpeed:(NSString *)speed withUID:(NSInteger)uid;
+ (void)updateTaskSizePercent:(NSString *)sizePercent withUID:(NSString *)uid;
+ (void)updateTaskProgressPercent:(CGFloat)progress withUID:(NSString *)uid;
+ (void)updateTaskFilePath:(NSString *)filePath withUID:(NSString *)uid;

@end
